/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bamboo.drawingkid.views.components;

import com.nokia.mid.ui.TextEditor;
import javax.microedition.lcdui.Graphics;

/**
 *
 * @author tkor
 */
public class CharEraserButton extends Button {

    private TextEditor editor;

    public CharEraserButton(TextEditor texteditor) {
        super("/dialog_btn_pressed.png", "/dialog_btn.png");
        editor = texteditor;
    }

    public void onSelected() {
        int caretPosition = editor.getCaretPosition();
        editor.delete(caretPosition-1, 1);
    }
    public void render(Graphics g) {
        super.render(g);
        g.setColor(0x000000);
        g.drawString("Clear", this.x + (width / 2), this.y + (height / 2)+5, Graphics.BASELINE | Graphics.HCENTER);
    }
}
